package com.example.su_shi_tan_core.db

import com.example.su_shi_tan_core.bean.SignUserBean
import java.io.Serializable

data class UserInfoBean(
    var account: String,
    var addres: String,
    var adminid: Int,
    var avatar: String,
    var birthday: Int,
    var brokerage_price: String,

    //身份证号码
    var card_id: String,

    var email: String,
    var group_id: Int,
    var identification: String,
    var integral: String,
    var invite_code: String,

    //是否实名验证0未实名1已实名
    var is_check: Int,

    //实名状态0未实名1提交实名验证2验证通过3审核失败
    var check_status: Int,

    //是否是社区0否1是
    var is_community: Int,

    //是否添加了收款信息0否1是
    var is_collection: Int,

    //是否添加了收货地址0否1是
    var is_address: Int,

    //是否激活0否1是
    var is_activation: Int,

    var is_promoter: Int,
    var level: Int,
    var login_type: String,
    var nickname: String,
    var now_money: String,
    var partner_id: Int,
    var pay_count: Int,
    var phone: String,

    //真实姓名
    var real_name: String,
    var self_buy: String,
    var sign_num: Int,
    var spread_count: Int,
    var spread_time: Int,
    var spread_uid: Int,
    var total_achievement: String,
    var uid: Int,
    var user_type: String,

    //身份证正面照
    var card_pros_url: String,

    //身份证反面照
    val card_cons_url: String,

    var mSignUserBean: SignUserBean?
) : Serializable {

    companion object {

        //未实名
        const val unSubmit = 0

        //审核中
        const val checking = 1

        //审核通过
        const val checkedYes = 2

        //审核未通过
        const val checkedNot = 3


    }

    fun isCollection() = is_collection == 1

    fun isAddress() = is_address == 1

    fun isActivation()=is_activation==1

    fun getUserName(): String {
        if (nickname.isEmpty()) return "unkown"
        return nickname
    }

    fun getAccountStr(): String {

        return "登录ID  $account"
    }

    fun invitationCodeStr(): String {
        return "邀请码  $invite_code"
    }

    fun verifyStrFlag(): Int {
        return check_status
//        return if (check_status == unSubmit)
//            is_check
//        else
//            check_status
    }

    fun verifyStr(): String {
        return when (check_status) {
            unSubmit -> "未实名认证"
            checking -> "审核中"
            checkedYes -> "已实名认证"
            checkedNot -> "审核未通过"
            else -> "审核未通过"
        }

    }
}